﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpDepend.XamarinForms.Controls
{
    public delegate void EventOnNativeSizeChanged(double width, double height);

    public class NativeView : Xamarin.Forms.View
    {
        private object mNativeControl;

        public event Action OnNativeViewChanged;

        public event EventOnNativeSizeChanged OnNativeSizeChanged;

        public void RaiseOnNativeSizeChanged(double width, double height)
        {
            var call = OnNativeSizeChanged;
            if (call != null)
            {
                call(width, height);
            }
        }

        public object NativeControl
        {
            get { return mNativeControl; }
            set
            {
                mNativeControl = value;

                var call = OnNativeViewChanged;
                if (call != null)
                {
                    call();
                }
            }
        }
    }
}
